home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: 100435.736@compuserve.com (David A. Mair)
- Newsgroups: comp.lang.c++
- Subject: Re: Interrupt handlers in classes.
- Date: Wed, 10 Apr 1996 09:36:11 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4kfvef$s6k@arl-news-svc-4.compuserve.com>
- References: <316a9ea3.0@news.globalnet.co.uk>
- NNTP-Posting-Host: dd41-171.compuserve.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- barog@globalnet.co.uk (Barog) wrote:
-
- >Please help I need to know how to put an interrupt handler in a class
- >and be able to set the interrupt handler to a vector with another
- >class member(Install_Handler()).
-
- You will have to make the interrupt handler a static member function
- since it will then have the correct linkage for the interrupt call.
- This means it will have no access to per instance data. I normally
- gain that access by list of pointers to the class as a static member
- variable of the class. Then, when I Install_Handler() I store the
- interrupt number with the value of this in the static list. The
- interrupt handler then has to parse the list looking for the value of
- this for the interrupt it is servicing, then it can use per-instance
- data. However, I can only see this being viable in hardware interrupt
- handlers because you can find out which interrupt was called. You
- can't guarantee that you can check the instruction before the return
- address to get the interrupt number for a software interrupt and it is
- not possible to use the interrupt vector table to find the address of
- the function being executed. Anyway, I have managed this sort of
- thing for comms handlers in the past, so it is possible.
-
- Regards
- David.
-
-
-